﻿using System;
using System.Collections.ObjectModel;
using Automator.Tasks.Core;

namespace Automator.Runtime
{
    public static class TaskClipboard
    {
        #region Fields
        
        private static ObservableCollection<Task> _instance = new ObservableCollection<Task>();
        
        #endregion
        
        #region Properties
        
        public static ObservableCollection<Task> Instance
        {
            get { return _instance; }
        }
        
        #endregion
        
        #region Methods
        
        public static void Add(Task task)
        {
            _instance.Insert(0, task);
        }
        
        public static void Remove(Task task)
        {
            _instance.Remove(task);
        }
        
        public static void Paste(Task task, Workflow workflow)
        {
            workflow.Tasks.Add(task);
            workflow.Modified = true;
            Remove(task);
        }
        
        #endregion
    }
}
